import moment from 'moment';
import { connect, history } from 'umi';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Button, message, Spin, Form, Space, Tabs } from 'antd';

import { SHTG_CHECKSTATE, SHTH_CHECKSTATE, SHZ_CHECKSTATE } from '../../Acommon/PurchaseState';
import {
  BZWC_STATE,
  BZ_businessCategory,
  BZ_flowBusinessType,
  BZ_orderType,
  BZ_requestController,
  DBZ_STATE,
  DCG_SQSTATE,
  FB_STATE,
  WJBZZ_STATE,
  gl_formFunc,
} from '../common/Format';
import '../common/style.less';
import { ILoadMapTypeAll } from '@/common';
import ContractModal from './ContractModal';
import { ntkoQueryParams } from '../mconfig';
import { getBaseUrl } from '@/services/urlconst';
import { closeCurrent, processingDataFun } from '../../Acommon';

import pageStyles from '@/common/pageLayout.less';
import { NtkoPlugin } from '@/common/NtkoPluginType';
import ScrollBarLayout from '@/components/ScrollBarLayout';
import { readReadShowFileService } from '@/services/BaseLayout';
import { ColumnsUpdateConfig, tenderDocumentsColumnsUpdateConfig } from '../mconfig/NewUpdateColumns';
import { DescriptionsType, useDescriptionsType } from '@/components/DescriptionsType';
import { editPurchaseSourcePackServices, getPurchaseSourcePackServices, saveToURLWordService, syncApplyStateService } from '../services/UpdateService';
import {
  getColorTextLoadMap,
  getKeyRouter,
  getLoadMapList,
  getPosIDs,
  getSelectDataCommon,
  getTenantID,
  getUserID,
  wordHandChildParam,
  wordToChildParams,
} from '@/utils';
import { WorkflowChedkRecord, WorkflowHndTaskBtn, WorkflowNoDefaultTable, WorkflowSwitchModal } from '@/components/WorkflowCommonCopy';

const UpdateDocumentationView = ({ locationProps, curRes }) => {
  const prefixCls = 'documentatio-update';

  const [radioState, setRadioState] = useState<Record<string, any>>({
    /** 表单Col控制显示和隐藏的状态 */
    packFlag: 0,
    siteVisitFlag: 0,
    meetFlag: 0,
    sampleFlag: 0,
    productFlag: 0,
    charge: 0,
    unify: 0,
    sampleCheck: 0,
    supplyType: 1, // 项目属性  0 = 服务 1 = 货物
    bidMarginFlag: 0,
  });

  const [infoState, setInfoState] = useState<Record<string, any>>({}); /** 存储详情 */
  const [uploadUrl, setUploadUrl] = useState<Record<string, any>>({}); /** 存储上传的文件地址 */
  const [isShow, setIsShow] = useState<boolean>(false); /** 合同渲染状态 */
  const [procureReal, setBusinessType] = useState<string>(''); /** 判断展示类型 */
  const [isShowAuditRecord, setIsShowAuditRecord] = useState<boolean>(false); /** 审批记录渲染控制 */
  const [isFlag, setIsFlag] = useState(''); /** 保存标识 默认edit */
  const [delUrlList, setDelUrlList]: any = useState([]); /** 保存删除文件的路径 */
  const [invalidState, setInvalidState] = useState<Record<string, any>>({}); /**撤销弹窗*/
  const [formRef] = Form.useForm(); /**表单实例*/
  const [stateFlag, setStateFlag] = useState(false);
  const [activeKey, setActiveKey] = useState('1');

  /** 轻阅读预览 */
  const { readReadShowFileRun } = readReadShowFileService();

  /**轻阅读预览 */
  const onOpenReadOfdWord = (fieldUrl: string) => {
    readReadShowFileRun({ fieldPath: `${getBaseUrl()}${fieldUrl}` });
    // readReadShowFileRun({ fieldPath: `http://222.186.101.211:20103/${fieldUrl}` });
  };

  /** <<<====================================工作流=====================================>>>START */
  const [showSwitchFlow, setShowSwitchFlow] = useState<boolean>(false);
  const [workFlowInfoObj, setWorkFlowInfoObj] = useState<Record<string, any>>({
    selectFlowRows: {},
    showWorkFlowModal: false,
    saveNoDefaultFlowID: '',
  });
  const closeSwitchFlowModal = (isDefaultModal: boolean) => {
    if (isDefaultModal) {
      setWorkFlowInfoObj({
        ...workFlowInfoObj,
        showWorkFlowModal: true,
      });
    } else {
      setShowSwitchFlow(false);
    }
  };
  /** <<<====================================工作流=====================================>>>END */

  /** 字典集合 */
  const loadMdicIds: string[] = [`${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}`];
  const { loadMapInfo } = getLoadMapList(loadMdicIds);
  const industry_involveds = getSelectDataCommon(loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.INDUSTRY_INVOLVED}`], 'name', 'id');

  /** 修改单选状态 @param value 修改后的值 @param attribute 对应字段 */
  const changeRadio = (value: number, attribute: string) => {
    const param = { ...radioState, [attribute]: value };
    if (attribute == 'templateFlag') {
      setFieldsValue({ contractURL: null });
      setInfoState({ ...infoState, contractURL: null });
      param.contractURL = null;
    }
    setRadioState(param);
  };
  const changeInfo = (value: number, attribute: string) => {
    const param = { ...infoState, [attribute]: value };
    setInfoState(param);
  };

  /** 修改表单内容 */
  const changeFormFun = (value, type) => {
    if (type == 'bidPeriodDay') {
      setFieldsValue({ bidPeriodDay: value });
    }
  };

  /** 保存当前展示的表格中，删除的url地址 */
  const handleDelFileFn = (delFilePath: string, fileName = null) => {
    setDelUrlList([...delUrlList, delFilePath]);
    if (fileName) {
      const param = { ...uploadUrl, [fileName]: null };
      setUploadUrl(param);
    }
  };

  /** 上传文件路径赋值给详情 */
  const handleAddFileFn = (attachPaths, fileName) => {
    const param = { ...uploadUrl, [fileName]: attachPaths };
    setUploadUrl(param);
  };

  /** key=1,配置器 */
  let [config, { setFieldsValue }] = useDescriptionsType({
    labelWidth: 270,
    basicForm: formRef,
    schemas: ColumnsUpdateConfig({
      change: { changeRadio, changeInfo, setIsShow, handleDelFileFn, handleAddFileFn, changeFormFun, onOpenReadOfdWord },
      state: { radioState, infoState, industry_involveds },
      // tableTypes: procureReal, // 表单根据不同的状态，显示不同的表单 [Msetting]
      cardType: isFlag,
      formRef,
    }) as any,
  });

  /** key=2,配置器 */
  let [configs] = useDescriptionsType({
    labelWidth: 270,
    basicForm: formRef,
    schemas: tenderDocumentsColumnsUpdateConfig({
      change: { changeRadio, setIsShow, handleDelFileFn, handleAddFileFn, changeFormFun, onOpenReadOfdWord },
      state: { radioState, infoState, industry_involveds },
      // tableTypes: procureReal, // 表单根据不同的状态，显示不同的表单 [Msetting]
      cardType: isFlag,
      formRef,
    }) as any,
  });

  /** 获取包的详情【根据id】 Now*/
  const { getPurchaseSourcePackRun, getPurchaseSourcePackLoading } = getPurchaseSourcePackServices((res) => {
    if (res?.msgFlag) {
      let { procureReal, procureRealName, procureOrgName, state, checkState } = res?.obj;
      let [mpurchasePack] = res?.obj?.mpurchasePackList;

      if (state == WJBZZ_STATE() && checkState == SHZ_CHECKSTATE()) setStateFlag(true);

      const { colorText } = getColorTextLoadMap(procureRealName);
      setInfoState(res?.obj);

      // if (res?.obj?.supplyType) {
      //   let radioList = { ...res?.obj };
      //   if (res?.obj?.supplyType == `${getTenantID()}${ILoadMapTypeAll?.PURCHASE_CATEGORY}1000`) {
      //     radioList.supplyType = 1;
      //   } else {
      //     radioList.supplyType = 0;
      //   }
      // }

      setRadioState({ ...res?.obj }); // 展示行控制

      delete res?.obj?.['mpurchasePackList'];
      delete res?.obj?.['mpurchaseApply'];

      let result = res?.obj;

      /** 时间格式处理 */
      if (result?.siteVisitTime) result.siteVisitTime = moment(result?.siteVisitTime);
      if (result?.meetTime) result.meetTime = moment(result?.meetTime);

      /** 表单回显 */
      formRef?.setFieldsValue({
        ...result,
        procureReal: colorText,
        procureOrg: getColorTextLoadMap(procureOrgName)?.colorText,
        packName: mpurchasePack?.packName,
        packCode: mpurchasePack?.packCode,
      });

      if (colorText) setBusinessType(procureReal);

      if (
        state == `${getTenantID()}${ILoadMapTypeAll?.CURRYOUT_STATE}1001` &&
        checkState == `${getTenantID()}${ILoadMapTypeAll.ALLFLOW_CHECKRESULT}1000` &&
        locationProps?.state?.type &&
        locationProps?.state?.type != 'view'
      ) {
        history.push({
          pathname: `/purchaseSourceController/getSourceById/{id}/{currentUserID}/:${getKeyRouter()}${getKeyRouter()}`,
          state: {
            type: 'view',
            info: { ...res?.obj }, //id: record?.sourceID
            delRouterName: history.location.pathname, //必传,要删除的路由名称
            returnPathName: locationProps?.state?.returnPathName,
          },
        });
      }
    }
  });

  /** 暂存接口 */
  const { editPurchaseSourcePackRun, editPurchaseSourcePackLoading } = editPurchaseSourcePackServices((res) => {
    if (res?.msgFlag) {
      message?.success(res?.msg);
      /**详情获取最新数据*/
      getPurchaseSourcePackRun({ id: res?.obj });
    }
  });

  /** 监听器 -- 获取详情 */
  useEffect(() => {
    let { info, type } = locationProps?.state;
    if (info?.id) {
      getPurchaseSourcePackRun({ id: info?.id });
    }
    setIsFlag(type);
  }, [locationProps?.state]);

  /**同步申请【采购中】接口*/
  const { syncApplyStateRun, syncApplyStateLoading } = syncApplyStateService(() => {});

  useEffect(() => {
    if (infoState?.state == BZWC_STATE() && infoState?.checkState == SHTG_CHECKSTATE()) {
      if (stateFlag) {
        /**同步申请【采购中】接口*/
        syncApplyStateRun({ id: infoState?.applyID, state: `${getTenantID()}${ILoadMapTypeAll?.PURAPPLY_STATE}1005` });
      }
    }
  }, [infoState?.state, infoState?.checkState]);

  /** 更新页面方法 */
  const reloadInfoService = () => {
    getPurchaseSourcePackRun({ id: infoState?.id });
  };

  /** 处理工作流功能 权限 */
  const workflowPowerAllBtn = useMemo(() => {
    let pownerBtn: Record<string, any> = {
      revokeFlagBtn: false, //撤销按钮
      invalBoolBtn: false, //暂停开始按钮
      stopProcInstBtn: false, //流程作废接口
    };
    if (infoState?.state == DCG_SQSTATE()) {
      pownerBtn['revokeFlagBtn'] = true;
      pownerBtn['stopProcInstBtn'] = true;
    }

    const taskType: string = BZ_flowBusinessType();
    const taskHandInfo: Record<string, any> = infoState?.paramObject?.[taskType];
    if (
      taskHandInfo &&
      taskHandInfo?.mactivitiTaskList?.length > 0 &&
      taskHandInfo?.mactivitiTaskList?.[0]?.assigneePositionID == getPosIDs() &&
      taskHandInfo?.mactivitiTaskList?.[0]?.assigneeID == getUserID()
    ) {
      pownerBtn['invalBoolBtn'] = true;
    }
    return pownerBtn;
  }, [infoState]);

  /** 保存在线编辑权限 */
  const [saveNtkoQuery, setSaveNtkoQuery] = useState<Record<string, any>>({
    filedUrl: '',
    ntkoWordUrl: '',
  });

  /** 保存文件接口回调 */
  const saveToUrlWordCallback = (res: any) => {
    const messageObj = {
      msgFlag: res?.msgFlag,
      msgText: res?.msg,
      msgType: 'uploadFiledRequest',
    };
    wordToChildParams(ntkoBrowser, saveNtkoQuery?.ntkoWordUrl, messageObj);
  };

  /** 保存文件接口 */
  const { wordSaveToURLRun, wordSaveToURLLoading } = saveToURLWordService(saveToUrlWordCallback);

  /** 保存文件回调 */
  const ntkoCallback = (childValue) => {
    const childBase = JSON.parse(childValue);
    if (childBase?.baseUrl && childBase?.baseObj) {
      const fielUrl = childBase?.baseUrl?.split(getBaseUrl())?.[1];
      // const fielUrl = childBase?.baseUrl?.split(`http://222.186.101.211:20103`)?.[1];
      wordSaveToURLRun({
        ...childBase,
        baseUrl: fielUrl,
      });
    }
  };

  /** 引入在线预览 */
  const ntkoBrowser = useMemo(() => {
    const { ntkoBrowser } = NtkoPlugin(ntkoCallback);
    return ntkoBrowser;
  }, []);

  /** 打开在线编辑 */
  const onOpenEditField = (info: Record<string, any>) => {
    const { filedUrl, ntkoWordUrl } = ntkoQueryParams(info, curRes, 'bidTempFileURL');

    setSaveNtkoQuery({
      filedUrl,
      ntkoWordUrl,
    });

    const childStr = wordHandChildParam(info);
    const extensBool = ntkoBrowser.ExtensionInstalled();
    if (extensBool) {
      ntkoBrowser?.openWindow(ntkoWordUrl, false, '', childStr);
    }
  };

  /** 暂存事件 */
  const onHandleSave = async (flag = '') => {
    formRef
      ?.validateFields()
      .then((result) => {
        result = {
          ...infoState,
          ...result,
          ...uploadUrl,
          // supplyType: infoState?.supplyType,
          // supplyTypeName: infoState?.supplyTypeName,
          id: infoState?.id,
          versionNum: infoState?.versionNum,
        };

        let formObj: Record<string, any> = gl_formFunc(result);

        // 最高限价判断
        let ishow = Number(result?.expectCeilSum) <= Number(result?.expectSum) ? false : true;
        if (ishow) {
          message.error('请填写好完整信息后再暂存！');
          return;
        }

        // 合同金额判断
        if (result?.bidMargin && Number(result?.bidMargin) > 10) {
          message.error('请填写好完整信息后再暂存！');
          return;
        }

        let resultObj = {
          complexFlag: 0,
          ...formObj,
          id: infoState?.id,
          versionNum: infoState?.versionNum,
          delAttachURL: delUrlList?.join(','),
          changeFlag: infoState?.changeFlag,
          projectFlag: infoState?.projectFlag,
          procureReal,
          procureOrg: infoState?.procureOrg,
        };

        /** 暂存接口 */
        editPurchaseSourcePackRun(resultObj)?.then((res) => {
          if (res?.msgFlag && flag == 'onOpen') {
            /** 打开插件 */
            onOpenEditField(processingDataFun(resultObj));
          }
          if (res?.msgFlag && flag == 'onSubmit') {
            setWorkFlowInfoObj({
              selectFlowRows: resultObj,
              showWorkFlowModal: true,
              saveNoDefaultFlowID: '',
            });
          }
        });
      })
      .catch((res) => {
        message.error('请填写好完整信息后再暂存！');
      });
  };

  /** 提交事件 */
  const onHandleSubmit = async () => {
    if (isFlag == 'edit') {
      await onHandleSave('onSubmit');
    }
  };

  /** 按钮 */
  const footerDiv = useCallback(
    (flag = false) => {
      return (
        <>
          {isFlag == 'edit' &&
            curRes?.['/purchaseSourceController/editSource'] &&
            ((infoState?.state == DBZ_STATE() && !infoState?.checkState) ||
              (infoState?.state == WJBZZ_STATE() &&
                infoState?.checkState == SHTH_CHECKSTATE() &&
                infoState?.ownerID == getUserID() &&
                infoState?.ownPositionID == getPosIDs())) &&
            flag && (
              <Button type="primary" onClick={() => onHandleSave()}>
                暂存
              </Button>
            )}

          {activeKey == '2' && !infoState?.checkState && infoState?.busiFileURL && curRes?.['/purchaseSourceController/startProcess/{starterDeptID}'] && (
            <Button type="primary" onClick={onHandleSubmit}>
              提交
            </Button>
          )}

          {isFlag == 'edit' &&
            activeKey == '1' &&
            infoState?.versionNum > 0 &&
            curRes?.['/purchaseSourceController/saveToURL'] &&
            infoState?.bidTempFileURL &&
            infoState?.procureOrg == `${getTenantID()}${ILoadMapTypeAll?.PURCHASE_METHOD}1000` && (
              <Button type="primary" onClick={async () => await onHandleSave('onOpen')}>
                预览
              </Button>
            )}

          {activeKey == '1' && isFlag == 'edit' && infoState?.versionNum > 0 && flag && (
            <Button type="primary" onClick={() => setActiveKey('2')}>
              招标文件
            </Button>
          )}

          {activeKey == '2' && isFlag == 'edit' && infoState?.versionNum > 0 && flag && (
            <Button type="primary" onClick={() => setActiveKey('1')}>
              文件编制
            </Button>
          )}

          {locationProps?.state?.returnPathName && (
            <Button danger onClick={() => closeCurrent(locationProps?.state?.returnPathName)}>
              关闭
            </Button>
          )}
        </>
      );
    },
    [infoState, curRes, activeKey, isFlag],
  );

  /** tabs标签页 */
  const tabsItem = useMemo(() => {
    let items: any[] = [
      {
        label: '文件编制',
        key: '1',
        children: (
          <div style={{ height: '100%', overflow: 'hidden', background: '#fff' }}>
            <Spin
              spinning={getPurchaseSourcePackLoading || editPurchaseSourcePackLoading || wordSaveToURLLoading || syncApplyStateLoading}
              style={{ height: '100%' }}
            >
              <div
                style={{
                  height: '100%',
                  display: 'flex',
                  flexDirection: 'column',
                }}
              >
                <ScrollBarLayout style={{ padding: '8px 6px' }}>
                  <div className={prefixCls + '-renderFormTableBox'}>
                    <DescriptionsType config={config} />
                  </div>
                </ScrollBarLayout>
                <div
                  style={{
                    height: '50px',
                    borderTop: '1px dashed #ccc',
                    display: 'flex',
                    flexDirection: 'column',
                    justifyContent: 'center',
                    alignItems: 'center',
                  }}
                >
                  <Space>{footerDiv()}</Space>
                </div>
              </div>
            </Spin>
          </div>
        ),
      },
    ];

    if (infoState?.versionNum > 0) {
      items?.push({
        label: '招标文件',
        key: '2',
        children: (
          <div style={{ height: '100%', overflow: 'hidden', background: '#fff' }}>
            <Spin
              spinning={getPurchaseSourcePackLoading || editPurchaseSourcePackLoading || wordSaveToURLLoading || syncApplyStateLoading}
              style={{ height: '100%' }}
            >
              <div
                style={{
                  height: '100%',
                  display: 'flex',
                  flexDirection: 'column',
                }}
              >
                <ScrollBarLayout style={{ padding: '8px 6px' }}>
                  <div className={prefixCls + '-renderFormTableBox'}>
                    <DescriptionsType config={configs} />
                  </div>
                </ScrollBarLayout>
                <div
                  style={{
                    height: '50px',
                    borderTop: '1px dashed #ccc',
                    display: 'flex',
                    flexDirection: 'column',
                    justifyContent: 'center',
                    alignItems: 'center',
                  }}
                >
                  <Space>{footerDiv()}</Space>
                </div>
              </div>
            </Spin>
          </div>
        ),
      });
    }

    return items;
  }, [
    infoState,
    curRes,
    activeKey,
    isFlag,
    radioState,
    getPurchaseSourcePackLoading,
    editPurchaseSourcePackLoading,
    wordSaveToURLLoading,
    syncApplyStateLoading,
  ]);

  return (
    <div
      style={{
        height: '100%',
        overflow: 'hidden',
        display: 'flex',
        flexDirection: 'column',
      }}
    >
      <div className={prefixCls}>
        <Tabs
          type="card"
          className={pageStyles['commonTabs']}
          items={tabsItem}
          activeKey={activeKey}
          onChange={(key) => setActiveKey(key)}
          tabBarExtraContent={
            <Space>
              {/* 流程审批按钮 */}
              {footerDiv(true)}
              <WorkflowHndTaskBtn
                flowDetailInfo={infoState}
                reloadCallback={reloadInfoService}
                requestController={BZ_requestController()}
                isAloneSubmit={infoState?.state == WJBZZ_STATE() && infoState?.checkState == SHTH_CHECKSTATE()}
                flowBusinessType={BZ_flowBusinessType()}
                applyHeader={'own'}
                revokeRequestUrl={'/purchaseSourceController/invalid'}
                revokeRequestState={`${getTenantID()}${ILoadMapTypeAll?.CURRYOUT_STATE}`}
                isShowRevokeStateList={[WJBZZ_STATE()]}
                revokeTitle={infoState?.packName}
                revokeSuccessCallback={() => {
                  history.push({
                    pathname: `/purchaseSourceController/editSource/:${getKeyRouter()}${getKeyRouter()}`,
                    state: {
                      type: 'edit',
                      info: infoState,
                      delRouterName: history?.location?.pathname,
                      returnPathName: locationProps?.state?.returnPathName,
                    },
                  });
                }}
              />
            </Space>
          }
        />

        {isShow && (
          <ContractModal
            onSave={(rows) => {
              if (rows?.length) {
                setFieldsValue({ contractURL: rows?.[0]?.templateURL });
                setRadioState({ ...radioState, contractURL: rows?.[0]?.templateURL });
                setInfoState({ ...infoState, contractURL: rows?.[0]?.templateURL });
              }
            }}
            onClose={() => setIsShow(false)}
            curRes={curRes}
          />
        )}

        {/* 发起流程审批 */}
        {workFlowInfoObj?.showWorkFlowModal && (
          <WorkflowSwitchModal
            openVisible={workFlowInfoObj?.showWorkFlowModal}
            businessInfoObj={workFlowInfoObj?.selectFlowRows}
            requestController={BZ_requestController()}
            orderType={workFlowInfoObj?.selectFlowRows?.orderType || BZ_orderType()}
            category={BZ_flowBusinessType()}
            businessCategory={BZ_businessCategory()}
            reloadInfoCallback={reloadInfoService}
            openFlowChangeModal={setShowSwitchFlow}
            selectFlowID={workFlowInfoObj?.saveNoDefaultFlowID}
            onClose={() => {
              setWorkFlowInfoObj({
                ...workFlowInfoObj,
                showWorkFlowModal: false,
              });
            }}
            replaceStrObj={{
              own: 'own',
              workflowType: 'category',
            }}
          />
        )}

        {/* 挑选流程组件 */}
        {showSwitchFlow && (
          <WorkflowNoDefaultTable
            openVisibleSwitch={showSwitchFlow}
            onCloseSwitch={closeSwitchFlowModal}
            requestController={BZ_requestController()}
            orderType={workFlowInfoObj?.selectFlowRows?.orderType || BZ_orderType()}
            category={BZ_flowBusinessType()}
            businessCategory={BZ_businessCategory()}
            saveSelectFlowID={(flowId: string) => {
              setWorkFlowInfoObj({
                ...workFlowInfoObj,
                saveNoDefaultFlowID: flowId,
              });
            }}
            selectFlowID={workFlowInfoObj?.saveNoDefaultFlowID}
          />
        )}
      </div>

      {/* 审核记录 */}
      {infoState?.paramObject?.[BZ_flowBusinessType()] && (
        <WorkflowChedkRecord
          curRes={curRes}
          dataDetailInfo={infoState}
          flowBusinessType={BZ_flowBusinessType()}
          requestController={BZ_requestController()}
          reloadPageCallback={reloadInfoService} // 刷新方法-详情方法
          revokeStateID={DCG_SQSTATE()}
          allBtnFuncQuqry={workflowPowerAllBtn}
          tabPaneHeight={0.35}
          isCheckDrawer={true}
          isShowCollapse={isShowAuditRecord}
          changeCollapse={(val) => setIsShowAuditRecord(val)}
          cancelStateId={FB_STATE()}
          isSyncArchive={true}
        />
      )}
    </div>
  );
};

export default connect(({ baseLogin, navTab }: Record<string, any>) => ({
  curRes: baseLogin?.permissions,
  navTab,
}))(UpdateDocumentationView);

// if (procureReal === DYLY()) {
//   /**单一来源数据处理*/
//   formObj = handleForm_DYLY(result);
// } else if (procureReal === GKZB() || procureReal === YQZB() || procureReal == ZF_GKZB() || procureReal == ZF_YQZB()) {
//   /**处理`公开招标` &&  `邀请招标`*/ // ZF_DDCG & ZF_BJFPJJ
//   formObj = handleForm_GKZB(result);
// } else if (procureReal === JZXTP() || procureReal === ZF_JZXTP()) {
//   /**处理`竞争性谈判方式`*/
//   formObj = handleForm_JZXTP(result);
// } else if (procureReal === JZXCS() || procureReal === ZF_JZXCS()) {
//   /**处理`竞争性磋商方式`*/
//   formObj = handleForm_JZXCS(result);
// } else if (procureReal === XJCG()) {
//   /**处理`询价采购方式`*/
//   formObj = handleForm_XJCG(result);
// } else if (procureReal === KJXYCG()) {
//   /**处理`框架协议采购方式`*/
//   formObj = handleForm_KJXYCG(result);
// } else if (procureReal === BJXJ() || procureReal === ZF_BJXJ()) {
//   /**处理`便捷询价方式`*/
//   formObj = handleForm_BJXJ(result);
// } else if (procureReal === BJCS() || procureReal === ZF_BJCS()) {
//   /**处理`便捷磋商方式`*/
//   formObj = handleForm_BJCS(result);
// } else if (procureReal === BJKJ() || procureReal === ZF_BJKJ()) {
//   /**处理`便捷框架协议采购方式`*/
//   formObj = handleForm_BJKJXYCG(result);
// }

{
  /* {
      curRes['/purchaseSourceController/invalid'] &&
      infoState?.id &&
      infoState?.ownerID == getUserID() &&
      infoState?.ownPositionID == getPosIDs() &&
      infoState?.state == WJBZZ_STATE() && (
<Button
  type="primary"
  danger
  // icon={<RollbackOutlined />}
  onClick={() => {
    setInvalidState({ isShow: true, resObj: infoState });
  }}
>
  撤销
</Button>
      )} */
}

{
  /* 
{invalidState?.isShow && (
  <RevokeModal
    resObj={invalidState?.resObj}
    revokeRequestUrl={'/purchaseSourceController/invalid'}
    onClose={() => setInvalidState({})}
    reqBody={{ state: DBZ_STATE() }}
    modalTip={
      <div style={{ color: '#000' }}>
确认是否撤销【<span style={{ color: 'red' }}>{invalidState?.resObj?.packName}</span>】的审核, 撤销后可重新提交！
      </div>
    }
    reloadRequest={() => {
      history.push({
pathname: `/purchaseSourceController/editSource/:${getKeyRouter()}${getKeyRouter()}`,
state: {
  type: 'edit',
  info: invalidState?.resObj,
},
      });
    }}
  />
)} 
 */
}
